Namespace OpenArchive
    Namespace System
        Namespace DB
            Namespace Tables
                <Serializable(), Reflection.DefaultMember("Components")> _
                Public Class DocTable
                    Private m_ID As Long
                    Private m_VolumeID As Long
                    Private m_Created As Date
                    Private m_Deleted As Boolean
                    Private m_DocType As String
                    Private m_Components As CompTable()
                    Public Property ID() As Long
                        Get
                            Return m_ID
                        End Get
                        Set(ByVal value As Long)
                            m_ID = value
                        End Set
                    End Property
                    Public Property DocType() As String
                        Get
                            Return m_DocType
                        End Get
                        Set(ByVal value As String)
                            m_DocType = value
                        End Set
                    End Property
                    ''' <summary>
                    ''' In Cache, the VolumeID is 0
                    ''' </summary>
                    ''' <value></value>
                    ''' <returns></returns>
                    ''' <remarks></remarks>
                    Public Property VolumeID() As Integer
                        Get
                            Return m_VolumeID
                        End Get
                        Set(ByVal value As Integer)
                            m_VolumeID = value
                        End Set
                    End Property
                    ''' <summary>
                    ''' Number of components
                    ''' </summary>
                    ''' <value></value>
                    ''' <returns></returns>
                    ''' <remarks></remarks>
                    Public ReadOnly Property Count() As Integer
                        Get
                            If Not m_Components Is Nothing Then
                                Return m_Components.Length
                            End If
                        End Get
                    End Property
                    Public Property Created() As Date
                        Get
                            Return m_Created
                        End Get
                        Set(ByVal value As Date)
                            m_Created = value
                        End Set
                    End Property
                    ''' <summary>
                    ''' 
                    ''' </summary>
                    ''' <value></value>
                    ''' <returns></returns>
                    ''' <remarks></remarks>
                    Public ReadOnly Property Components() As CompTable()
                        Get
                            Return m_Components
                        End Get
                    End Property
                    Public Property Deleted() As Boolean
                        Get
                            Return m_Deleted
                        End Get
                        Set(ByVal value As Boolean)
                            m_Deleted = value
                        End Set
                    End Property
                    Public Sub AddComponentEntry(ByVal ComponentEntry As CompTable)
                        ' Increase size of array
                        If m_Components Is Nothing Then
                            m_Components = New CompTable(0) {}
                        Else
                            Dim destinationArray As CompTable() = New CompTable(m_Components.Length) {}
                            Array.Copy(m_Components, 0, destinationArray, 0, m_Components.Length)
                            m_Components = destinationArray
                        End If
                        ' Add ComponentEntry
                        m_Components(m_Components.Length - 1) = ComponentEntry
                    End Sub
                End Class
            End Namespace
        End Namespace
    End Namespace
End Namespace
